import { ApiProperty } from '@nestjs/swagger';
import { Column, Entity } from 'typeorm';
import { BaseEntity } from '../../../base.entity';

@Entity({ name: 'wip_shutdown_list' })
export default class WipShutdownList extends BaseEntity {
  @Column({ type: 'varchar', length: 50, name: 'shutdown_code', unique: true, comment: '停机编号' })
  @ApiProperty()
  shutdownCode: string;

  @Column({ type: 'varchar', length: 50, name: 'report_code', comment: '报工编号' })
  @ApiProperty()
  reportCode: string;

  @Column({ type: 'varchar', length: 50, name: 'order_code', comment: '工单编号' })
  @ApiProperty()
  orderCode: string;

  @Column({ type: 'varchar', length: 50, name: 'machine_code', comment: '设备编号' })
  @ApiProperty()
  machineCode: string;

  @Column({ type: 'varchar', name: 'shift_code', nullable: true, comment: '班组编号' })
  @ApiProperty()
  shiftCode: string;

  @Column({ type: 'varchar', name: 'material_code', nullable: true, comment: '产品编号' })
  @ApiProperty()
  materialCode: string;

  @Column({ type: 'varchar', name: 'material_name', nullable: true, comment: '产品名称' })
  @ApiProperty()
  materialName: string;

  @Column({ type: 'varchar', name: 'report_user_list', nullable: true, comment: '上工人员' })
  @ApiProperty()
  reportUserList: string;

  @Column({
    type: 'varchar',
    name: 'shutdown_reason_code',
    nullable: true,
    comment: '停机原因编号',
  })
  @ApiProperty()
  shutdownReasonCode: string;

  @Column({
    type: 'varchar',
    name: 'shutdown_reason_name',
    nullable: true,
    comment: '停机原因名称',
  })
  @ApiProperty()
  shutdownReasonName: string;

  @Column({
    type: 'datetime',
    name: 'shutdown_start_time',
    nullable: true,
    comment: '停机开始时间',
  })
  @ApiProperty()
  shutdownStartTime: Date;

  @Column({ type: 'datetime', name: 'shutdown_end_time', nullable: true, comment: '停机结束时间' })
  @ApiProperty()
  shutdownEndTime: Date;

  @Column({ type: 'float', name: 'shutdown_duration', nullable: true, comment: '停机时长' })
  @ApiProperty()
  shutdownDuration: number;

  @Column({ type: 'varchar', nullable: true, comment: '备注' })
  @ApiProperty()
  remark: string;

  @Column({ type: 'float', name: 'erp_no', nullable: true, comment: '第三方订单编号' })
  @ApiProperty()
  erpNo: string;
}
